<template>
  <view class="container">
    <!-- 顶部组件 -->
    <u-navbar
      :is-back="true"
      :background="{ background: '#fff' }"
      :border-bottom="false"
      id="nav-bar"
      title="终端状态"
    >
    </u-navbar>
    <view class="main-header">
      <u-search
        placeholder="请输入SN/商户名称搜索"
        bg-color="#F7F7F7"
        v-model="keyword"
      ></u-search>
      <u-tabs
        :list="tabList"
        :is-scroll="false"
        :current="tabCurrent"
        @change="change"
      ></u-tabs>
    </view>
    <!-- 订单列表 -->
    <!-- <mescroll-body
        ref="mescrollRef"
        @init="mescrollInit"
        top="0"
        @down="downCallback"
        :up="upOption"
        @up="upCallback"
      > -->

    <view class="list">
      <view class="item">
        <view class="header">
          <view class="title-box">
            <view class="title">SN:000214656555846</view>
            <view class="subTitle">解绑汇数生活</view>
          </view>
        </view>
        <view class="row">
          <view class="label">品牌</view>
          <view class="value">联动优势</view>
        </view>
        <view class="row">
          <view class="label">政策类型</view>
          <view class="value">普通版(0押)</view>
        </view>
        <view class="row">
          <view class="label">入库时间</view>
          <view class="value">2024-01-02 </view>
        </view>
        <view class="row">
          <view class="label">商户名称</view>
          <view class="value">华北平原股份有限公司 </view>
        </view>
        <view class="row">
          <view class="label">绑定时间</view>
          <view class="value">2024-12-01 14:13:24 </view>
        </view>
        <view class="row">
          <view class="label">流量卡收取规则</view>
          <view class="value">
            这个一段流量卡收取规则这个一段流量卡收取规则这个一段流量卡收取规则这
          </view>
        </view>
      </view>
    </view>

    <!-- </mescroll-body> -->
  </view>
</template>
<script>
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins.js';
import service from '@/common/service';
import util from '@/common/utils';

export default {
  mixins: [MescrollMixin],
  data() {
    return {
      upOption: {
        page: {
          num: 0,
          size: 10,
        },
        noMoreSize: 5,
        empty: {
          icon: 'https://api.hjsfpay.com/image/newimg/all-noData.png',
          tip: '',
        },
      },
      mescroll: null,
      tabList: [
        {
          name: '未绑定',
          count: 0,
        },
        {
          name: '未激活',
          count: 0,
        },
        {
          name: '已激活',
          count: 0,
        },
        {
          name: '已达标',
          count: 0,
        },
      ],
      tabCurrent: 0,
      currentData: {},
      keyword: '',
    };
  },
  onLoad(e) {
    if (e.tab) {
      this.tabCurrent = Number(e.tab);
    }
  },
  methods: {
    customBack() {
      uni.switchTab({
        url: '/pages/my/index',
      });
    },
    mescrollInit(mescroll) {
      this.mescroll = mescroll;
    },
    downCallback() {
      this.recordList = [];
      this.mescroll.resetUpScroll();
    },
    upCallback(page) {
      this.getTradePage(page);
    },
    getTradePage(page) {
      const that = this;
      const param = {
        pageNumber: page.num,
        pageSize: page.size,
        status: that.tabCurrent,
      };
      service.getTradePage(
        param,
        function (res) {
          if (res && res.data) {
            that.mescroll.endSuccess(res.data.data.length);
            if (page.num == 1) that.recordList = [];
            that.recordList = that.recordList.concat(res.data.data);
          }
        },
        function (res) {}
      );
    },
    change(index) {
      this.tabCurrent = index;
      this.recordList = [];
      this.mescroll.resetUpScroll();
    },
  },
};
</script>

<style lang="scss" scoped>
page {
  background-color: #f5f5f5;
}

.container {
  width: 100%;
  min-height: 100vh;
  padding: 0;
  text-align: center;
  background-color: #f5f5f5;
}

.list {
  width: 100%;
  padding: 30rpx;
  .item {
    position: relative;
    width: 100%;
    height: auto;
    padding: 30rpx;
    background: #ffffff;
    border-radius: 16rpx;
    .header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      padding: 0 0 30rpx;
      border-bottom: 1rpx solid #eeeeee;
      .title-box {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        line-height: 1;
        width: 100%;
        .title {
          font-weight: 800;
          font-size: 28rpx;
          color: #333333;
        }
        .subTitle {
          margin-top: 13rpx;
          font-weight: 400;
          font-size: 24rpx;
          color: #b7926e;
        }
      }
      .status {
        margin-left: 10rpx;
        height: 28rpx;
        line-height: 28rpx;
        padding: 0 18rpx;
        font-family: PingFang SC, sans-serif;
        font-weight: 400;
        font-size: 20rpx;
        border-radius: 14rpx;
      }

      .blue {
        color: #3388ff;
        background: #e5f0ff;
      }

      .red {
        color: #fa6161;
        background: #ffe5e5;
      }

      .purple {
        color: #6d5acb;
        background: #eae5ff;
      }

      .green {
        color: #22c071;
        background: #d5f5e5;
      }

      .yellow {
        color: #ffbb33;
        background: #fff6e5;
      }
    }
  }
}

.main-header {
  width: 100%;
  padding: 0 30rpx;
  background-color: #ffffff;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 15rpx 0;
  .label {
    width: 120rpx;
    font-weight: 400;
    font-size: 24rpx;
    color: #999999;
    text-align: left;
  }
  .value {
    flex: 1;
    min-width: 0;
    padding-left: 60rpx;
    font-weight: 400;
    font-size: 24rpx;
    color: #333333;
    text-align: right;
  }
}
</style>
